<?php
/**
 * Created by PhpStorm.
 * User: tom_xia
 * Date: 2018/7/2
 * Time: 13:45
 * 统计
 */
require_once dirname(__DIR__)."/common.php";
use app\cls\tom\Response;
use app\cls\tom\Queue;
use app\cls\tom\SysResource;
use app\cls\tom\Tools;

if(empty($_GET["uuid"]) || empty($_GET["type"])){
    Response::output(-2,"参数错误");
}
if(!Tools::isLegalUUID($_GET["uuid"])){
    Response::output(-1,"fail");
}
$host = @parse_url(isset($_SERVER['HTTP_REFERER'])?$_SERVER['HTTP_REFERER']:"",PHP_URL_HOST);
//if(strpos($host,'ottcn.com') === false){
//    exit(0);
//}
$type = intval($_GET["type"]);
$channelCode = empty($_GET["channel_code"]) ? "" : $_GET["channel_code"];
$redis = SysResource::getRedis();
$queue = new Queue($redis,REDIS_PREFIX."video_vv");
$queue->push(json_encode(["uuid"=>$_GET["uuid"],"type"=>$type,"channel_code"=>$channelCode,"time"=>time()]),rand(1,100));
Response::output(0,"ok");